<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>

<html lang="zh">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>简约书评网</title>
<script type="text/javascript" src="js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<link href="css/bootstrap.min.css" rel="stylesheet"/>
<link rel="stylesheet" href="css/font-awesome-4.7.0/css/font-awesome.css">
<link rel="stylesheet" href="css/pager.css">
<style type="text/css">
	.row > div {
		margin-bottom: 30px;
	}
</style>

</head>
<body>

<nav class="navbar navbar-expand-sm navbar-dark  border-bottom"
		style="margin-bottom: 30px;background:#140548">
		
	  <ul class="navbar-nav">

  </ul>
		
		<div class="collapse navbar-collapse justify-content-end"
			id="navbarSupportedContent">
			<ul class="navbar-nav" id="headerNav">
				<li class="nav-item" id="navMainPage"><a class="nav-link"
					href="#"> 欢迎您 </a></li>
				<!--此处添加代码，逻辑为：若用户已经登录（即session中名为currentUser的变量不为空），则显示该currentUser的用户名和注销超链接（logout.jsp），否则显示请登录字样，登录的超链接login.jsp）  -->
				<c:if test="${sessionScope.currentUser!=null}">
					<img src="${sessionScope.currentUser.picture}" style="width:40px;height:40px;border-radius:20px"/>
					 <li class='nav-item'> <div class="dropdown">
   						 <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
  							${sessionScope.currentUser.username}
    					</button>
					    <div class="dropdown-menu dropdown-menu-right">
							
					
					      <a class="dropdown-item" href="user/logout">注销</a>
					   
					    </div>
					  </div></li>
				
				</c:if>
				<c:if test="${sessionScope.currentUser==null}">
					 <li class='nav-item'> <a class="nav-link"
					href="loginForm.jsp"> 请登录</a></li>
				
				</c:if>
			
			</ul>
		</div>
	</nav>

</body>	